# import sys
# str=sys.stdin.readline()
# print(str)
#
# num=input("请输入一个数字")
# print(num)

# open('a.txt','w').write('hello world')
# open('a.txt')
# open('a.txt','w').write('hello world2')
file=open("a.txt",'r',buffering=1,encoding= 'utf-8')
print(file.read())
print("----------------------------------")
print((file.readline()))
print("----------------------------------")
file.seek(0)  # 将文件指针重置到文件开头
print((file.readlines()))
print("----------------------------------")
file.close()
with open("b.txt",'r',buffering=1,encoding= 'utf-8') as f:
  print(f.read())
print("----------------------------------")
# file.close()

with open("b.txt",'a',buffering=1,encoding= 'utf-8') as f:
        f.write("\n你好世界")
        file.seek(0)
        print((file.readlines()))
        file.close()

